<?php

use Grido\Grid,
	Grido\Components\Columns\Column,
	Grido\Components\Columns\Date,
	Grido\Components\Filters\Filter;

/**
 * Homepage presenter.
 */
class HomepagePresenter extends BasePresenter
{

	public function renderDefault()
	{
		//$events = $this->context->events->getAll();

		//$this->template->events = $events;
	}

	protected function createComponentGrid($name)
	{
	    $grid = new Grid($this, $name);

	    $grid->setModel($this->context->events->getAll());
	    $grid->setDefaultSort(array('created' => Column::DESC));

	   	$grid->addColumn('created', 'Vytvořeno', Column::TYPE_DATE)->setSortable()
		   	 ->setDateFormat(Date::FORMAT_DATE);
        $grid->addColumn('nameUser', 'Autor')->setSortable();
        $grid->addColumn('name', 'Název')->setSortable();
        $grid->addColumn('namePlace', 'Město')->setSortable();
        $grid->addColumn('from', 'Ulice', Column::TYPE_DATE)->setSortable()
        	 ->setDateFormat(Date::FORMAT_DATE);
        $grid->addColumn('to', 'GPS', Column::TYPE_DATE)->setSortable()
       	  	 ->setDateFormat(Date::FORMAT_DATE);
        $grid->addColumn('placesFree', 'GPS')->setSortable();
		$grid->addAction('add', 'Rezervovat')->setIcon('plus');
		$grid->addAction('detail', 'Detail')->setIcon('list-alt');
		$grid->addAction('edit', 'Edit')->setIcon('pencil');
		$grid->addAction('delete', 'Delete')->setIcon('trash');
	}

	/**
	 * Add Form control
	 * @return [type] [description]
	 */
	protected function createComponentAddForm()
	{
		return new Events\EventsForm();
	}
}
